﻿//添加
var fnCustomAdd = function () {
    document.getElementById("dialog1_h").innerHTML = "商品种类";
    document.getElementById("EditUIWindow").src = "/Extend/AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "";
    SetMaxDWH(YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

var fnCustomEdit = function (key) {

    var id = "";
    if (typeof (const_CurID) == "undefined") {
        id = myDataTable.getRecord(myDataTable.getSelectedRows()[0]).getData(const_entityID)
    } else {
        id = const_CurID;
    }

    formURL = "/Extend/AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + id;
    document.getElementById("EditUIWindow").src = formURL;

    var _btn = document.getElementById("yui-gen7-button");
    if (_btn != null && _btn != undefined) {
        _btn.style.display = "block";
    }
    if (key != undefined && _btn != null && _btn != undefined) {
        _btn.style.display = "none";
    }
    SetMaxDWH(YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

//格式化单元格
var f_b_zf = function (elCell, oRecord, oColumn, sData) {

    var sValue = oRecord.getData("b_zf");
    //var msgid = oRecord.getData("ID")
    var sText = "<font color='green'>有效</font>";

    if (sValue == "True") sText = "<font color='red'>无效</font>";

    elCell.innerHTML = sText;
}

